//
//  ZSY_UserSettingCell.m
//  ZSY_BreadTrip
//
//  Created by 张诗宇 on 16/1/9.
//  Copyright © 2016年 张诗宇. All rights reserved.
//

#import "ZSY_UserSettingCell.h"

@interface ZSY_UserSettingCell ()

@property (nonatomic, retain) ZSY_BaseImageView *userIcon;
@property (nonatomic, retain) ZSY_BaseLabel *nameLabel;


@end

@implementation ZSY_UserSettingCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)dealloc {
    [_userIcon release];
    [_nameLabel release];
    [super dealloc];
}

- (void)setName:(NSString *)name {
    if (_name != name) {
        [_name release];
        _name = [name retain];
        
        self.nameLabel.text = _name;
    }
}

- (void)setIconUrl:(NSString *)iconUrl {
    if (_iconUrl != iconUrl) {
        [_iconUrl release];
        _iconUrl = [iconUrl retain];
        NSURL *url = [NSURL URLWithString:_iconUrl];
        [self.userIcon sd_setImageWithURL:url];
        
    }
}



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews {
    self.userIcon = [[ZSY_BaseImageView alloc] initWithFrame:CGRectMake(20, 10, 60, 60)];
    self.userIcon.backgroundColor = [UIColor blackColor];
    self.userIcon.layer.cornerRadius = 30;
    self.userIcon.layer.masksToBounds = YES;
    [self.contentView addSubview:_userIcon];
    [_userIcon release];
    
    self.nameLabel = [[ZSY_BaseLabel alloc] initWithFrame:CGRectMake(100, 30, 100, 20)];
    self.nameLabel.text = @"1231231";
    [self.contentView addSubview:_nameLabel];
    [_nameLabel release];
}



@end
